package com.sds.sweng.swat.miplatform.ui.design.models.area;

import java.util.List;

import org.codehaus.jackson.annotate.JsonIgnore;

import com.sds.sweng.swat.miplatform.ui.design.models.MiplatformComponent;
import com.sds.sweng.swat.miplatform.ui.design.models.MiplatformContainer;
import com.sds.sweng.swat.miplatform.ui.design.models.area.sub.SubArea;
import com.sds.sweng.swat.miplatform.ui.design.models.area.sub.SubAreaContainer;
import com.sds.sweng.swat.miplatform.ui.design.utils.CloneUtils;



public abstract class AreaTemplate extends MiplatformContainer {

	private String areaTitle;
	private SubAreaContainer subAreaContainer;

	public AreaTemplate() {
		subAreaContainer = new SubAreaContainer();
		addChild(new AreaTemplateTitle());
		addChild(subAreaContainer);
	}

	public abstract void init();

	public AreaTemplate clone() {
		return (AreaTemplate) CloneUtils.hardClone(this);
	}

	public void setAreaTitle(String areaTitle) {
		this.areaTitle = areaTitle;
	}

	public String getAreaTitle() {
		return areaTitle;
	}

	public void addSubArea(SubArea subArea) {
		getSubAreaContainer().addChild(subArea);
	}

	@JsonIgnore
	public SubAreaContainer getSubAreaContainer() {
		return subAreaContainer;
	}

	@JsonIgnore
	public void setSubAreaContainer(SubAreaContainer subAreaContainer) {
		this.subAreaContainer = subAreaContainer;
	}

	public void setChildren(List<MiplatformComponent> children) {
		this.children = children;

		subAreaContainer = (SubAreaContainer) children.get(1);
	}

}
